import type { Http } from "wechat-http";
import http from "wechat-http";

// 扩展到全局对象 wx 中调用
declare global {
  namespace WechatMiniprogram {
    interface Wx {
      http: Http;
    }
  }
}

http.baseURL = "https://api-hmugo-web.itheima.net/api/public/v1";

wx.http = http;

export default http;

http.intercept.request = (params) => {
  return params;
};

http.intercept.response = (result) => {
  return result.data;
};
